cmake_minimum_required(VERSION 2.8)

set(PROJECT_NAME "nv.triangle3")
project("${PROJECT_NAME}")

if (UNIX)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/linux")
    set(PLATFORM_SRC GPUhelper/gh.linux.c)
    set(PLATFORM_LIB X11 GL)
    set(CMAKE_C_FLAGS "-Wall -msse2 -O2")
elseif (WIN32)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    add_definitions(-DGLEW_STATIC)
    set(PLATFORM_SRC GPUhelper/gh.windows.c)
    set(PLATFORM_LIB OpenGL32)
    set(CONSOLE_SYS WIN32)
endif ()

set(SRC
    app.c
    GPUhelper/gh.h GPUhelper/gh.c GPUhelper/gh.app.h GPUhelper/gh.math.h GPUhelper/gh.math.c
    GLEW/glew.c)

include_directories(./ GPUhelper)
add_executable("${PROJECT_NAME}" ${CONSOLE_SYS} ${SRC} ${PLATFORM_SRC})
target_link_libraries("${PROJECT_NAME}" ${PLATFORM_LIB})
